import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:getx_tutorial/app/data/services/settings_service.dart';
import 'package:getx_tutorial/app/routes/app_pages.dart';

class StatePage extends GetResponsiveView {

  @override
  Widget build(BuildContext context) {
    var settingsService = Get.find<SettingsService>();
    print('state_page: '+settingsService.toString());

    return Scaffold(
      appBar: AppBar(
        title: Text(settingsService.title+'-状态管理'),
        centerTitle: true,
      ),

      body: SafeArea(
        child: ListView(
          children: [
            ListTile(
              title: Text('状态管理 - Obx'),
              subtitle: Text('Get.toNamed("/state/obx")'),
              trailing: Icon(Icons.chevron_right),
              onTap: () {
                Get.toNamed(Routes.STATE+Routes.OBX);
              }
            ),
            ListTile(
              title: Text('状态管理 - GetxController'),
              subtitle: Text('Get.toNamed("/state/getxcontroller")'),
              trailing: Icon(Icons.chevron_right),
              onTap: () {
                Get.toNamed(Routes.STATE+Routes.GETXCONTROLLER);
              }
            ),

            ListTile(
              title: Text('状态管理 - GetX'),
              subtitle: Text('Get.toNamed("/state/getx")'),
              trailing: Icon(Icons.chevron_right),
              onTap: () {
                Get.toNamed(Routes.STATE+Routes.GETX);
              }
            ),
            ListTile(
              title: Text('状态管理 - GetBuilder'),
              subtitle: Text('Get.toNamed("/state/getbuilder")'),
              trailing: Icon(Icons.chevron_right),
              onTap: () {
                Get.toNamed(Routes.STATE+Routes.GETBUILDER);
              }
            ),

            ListTile(
              title: Text('状态管理 - ValueBuilder'),
              subtitle: Text('Get.toNamed("/state/valuebuilder")'),
              trailing: Icon(Icons.chevron_right),
              onTap: () {
                Get.toNamed(Routes.STATE+Routes.VALUEBUILDER);
              }
            ),
            ListTile(
              title: Text('状态管理 - ObxValue'),
              subtitle: Text('Get.toNamed("/state/obxvalue")'),
              trailing: Icon(Icons.chevron_right),
              onTap: () {
                Get.toNamed(Routes.STATE+Routes.OBXVALUE);
              }
            ),

            ListTile(
              title: Text('状态管理 - Workers'),
              subtitle: Text('Get.toNamed("/state/workers")'),
              trailing: Icon(Icons.chevron_right),
              onTap: () {
                Get.toNamed(Routes.STATE+Routes.WORKERS);
              }
            ),

            ListTile(
              title: Text('依赖管理 - find'),
              subtitle: Text('Get.toNamed("/state/dependency_find")'),
              trailing: Icon(Icons.chevron_right),
              onTap: () {
                Get.toNamed(Routes.STATE+Routes.DEPENDENCY_FIND);
              }
            ),
            ListTile(
              title: Text('依赖管理 - create'),
              subtitle: Text('Get.toNamed("/state/dependency_create")'),
              trailing: Icon(Icons.chevron_right),
              onTap: () {
                Get.toNamed(Routes.STATE+Routes.DEPENDENCY_CREATE);
              }
            ),
            ListTile(
              title: Text('依赖管理 - binding'),
              subtitle: Text('Get.toNamed("/state/dependency_binding")'),
              trailing: Icon(Icons.chevron_right),
              onTap: () {
                Get.toNamed(Routes.STATE+Routes.DEPENDENCY_BINDING);
              }
            ),
          ],
        )
      )
    );
  }
}